<?php if ($datalist && count($datalist)): ?>
<div class="col-lg-12">
<div class="box box-primary" id="profit_report_box">
    <div class="box-header">
        <div class="row" style="margin: 0">
            <h3 class="col-md-12 no-padding">{$Think.lang.集团销售利润表}
            <div class="pull-right unit" >
                <?php echo getUnitHtml('profit_report'); ?>
            </div>
            </h3>
        </div>
        <div class="row" style="margin: 0">
            <form  action="__URL__" method="post" id="profit_report_form">
                <div class="search-form pull-left col-md-6 col-sm-10 col-xs-9 no-padding">
                    <div class="col-md-12 no-padding">
                    <div class="table-title">
                        <label class="">{$Think.lang.年份}</label>
                        <select name="profit_report_year" >
                            <?php $year = !$_SESSION['report_time']['profit_report_year']? date('Y',time()):$_SESSION['report_time']['profit_report_year']; ?>
                            {$years | renderOptions = $year}
                        </select> </div>
                        <div class="table-title">
                        <label class="">{$Think.lang.月份}</label>
                        <select name="profit_report_month" onchange="formPosition(this,'profit_report_box')">
                            <?php $month = !$_SESSION['report_time']['profit_report_month']? date('m',strtotime("-1 months",time())):$_SESSION['report_time']['profit_report_month']; ?>
                            {$months | renderOptions = $month}
                        </select>
                        </div>
                    </div>
                </div>
                <div class="pull-right col-md-6 text-right no-padding">
                    <a href="__URL__/exportExcel/report_name/profit_report" class="glyphicon glyphicon-export" title="excel" style="  padding: 6px;"></a>
                </div>
            </form>
        </div>
    </div>
    <div class="box-body  table-responsive">
        <table class="table table-bordered table-striped" id="profit_report">
            <thead>
            <tr>
                <?php $px_num =  LANG_SET == 'zh-cn'? 'min-width:100px':'min-width:149px'; ?>
                <th style='{$px_num}'></th>
                <th>{$Think.lang.core-channel}</th>
                <!--<th>企业正常(ETS)</th>-->
                <th>{$Think.lang.etradesupply}</th>
                <!--<th>电商正常(ETS)</th>-->
                <th>{$Think.lang.总部}</th>
                <th>{$Think.lang.万力齐创}</th>
                <th>{$Think.lang.创联腾达}</th>
                <th>{$Think.lang.润达同创}</th>
                <th>{$Think.lang.诚源佳创}</th>
                <th>Recore</th>
                <th style="min-width: 83px">USA Office</th>
                <th>{$Think.lang.精锐时代}</th>
                <th>{$Think.lang.恒冠同创}</th>
                <th>{$Think.lang.爱米可可}</th>
                <th style="min-width: 46px">{$Think.lang.合计}</th>
                <!--<th>备注</th>-->
            </tr>
            </thead>
            <tbody>
            <?php for($i =0; $i<count($cols); $i++){ ?>
            <tr >
                <?php if (in_array($i,$fristNode)): ?>
                <td class="text-left"><b><?php echo L($cols[$i]); ?></b></td>
                <?php else: ?>
                <td class="text-right"><?php echo L($cols[$i]); ?></td>
                <?php endif; ?>
                <?php
                            for($j=0;$j<count($rows);$j++) {
                                    if ( $datalist[$i][$j] ):
                ?>
                <td class="text-center"><?php echo number_format($datalist[$i][$j],2); ?></td>
                <?php else: ?>
                <td></td>
                <?php
                            endif;
                            }
                 ?>
            </tr>
            <?php } ?>
            </tbody>
        </table>
    </div>
</div>
</div>
<?php endif; ?>